/* eslint valid-jsdoc: "off" */
const path = require('path');
'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // cookie 签名
  config.keys = appInfo.name + '_1632635694791_8256';

  //中间件配置
  config.middleware = [];

  // 自定义的配置
  const userConfig = {
    // myAppName: 'egg',
  };

  // 模板引擎
  config.view = {
    defaultViewEngine: 'nunjucks', // 默认的模板引擎
    defaultExtension: '.nj', // 默认的扩展名 (render() 的时候可以简写)
    root: [
      path.join(appInfo.baseDir, 'app/view'),
      path.join(appInfo.baseDir, 'path/to/another'),
    ].join(',')
  };

  return {
    ...config,
    ...userConfig,
  };
};
